<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:margin-right="http://www.w3.org/1999/xhtml"
      layout:decorator="layout/layout">
<head>
    <meta charset="UTF-8">
    <title>好友列表</title>
</head>
<body>
<div class="page-login-wrap">
    <div>
        <a href="/user/toAddFriend" style="margin-left: 1200px">添加好友</a><br>&nbsp;&nbsp;
        <a href="/index" style="margin-left: 1200px">首页</a>
        <a href="/user/myBlogList" style="margin-left: 1200px">我的博客</a>
        <a href="/blog/toAddBlog" style="margin-left: 1200px">添加博客</a>
    </div>
    <div th:if="${flag} == 1">
        <div style="font-size: 25px" align="center">好友请求列表</div>
        <table class="table" align="center">
            <colgroup>
                <col width="250px">
                <col width="250px">
            </colgroup>
            <thead>
            <tr>
                <th align="center">对方名称</th>
                <th align="center">是否同意</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="item:${friendMessageList}">
                <td align="center" th:text="${item.fromUserName}"></td>
                <td align="center"><a th:href='@{/user/agree(id=${item.id})}'>同意</a><a style="margin-left: 10px" th:href='@{/user/disAgree(id=${item.id})}'>拒绝</a></td>
            </tr>
            </tbody>
        </table>
    </div>

    <div th:if="${friendFlag} == 1" style="font-size: 25px" align="center">好友列表</div>

    <div th:if="${friendFlag} == 0" align="center">
        还没有好友呢!快去添加吧!
    </div>

    <div th:if="${friendFlag} == 1">
        <table class="table" align="center">
            <colgroup>
                <col width="250px">
                <col width="250px">
            </colgroup>
            <thead>
            <tr>
                <th align="center">好友名称</th>
                <th>添加时间</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="item:${friendList}">
                <td align="center" th:text="${item.username}"></td>
                <td align="center" th:text="${item.addTimeString}"></td>
            </tr>
            </tbody>
        </table>
    </div>

</div>
</body>
</html>